<?php

class Template {

    protected $_ci;
    function __construct()
    {
        $this->_ci = &get_instance();
    }

    function home($view, $data, $TITLE = "")
    {
        $data['TITLE'] = $TITLE;
        
        $data['bagian']['head']   = $this->_ci->load->view("home/template/v_head", $data, true);
        $data['bagian']['css']    = $this->_ci->load->view("home/template/v_css", $data, true);
        $data['bagian']['js']     = $this->_ci->load->view("home/template/v_script", $data, true);
        $data['bagian']['topbar'] = $this->_ci->load->view("home/template/v_topbar", $data, true);
        $data['bagian']['sidebar']= $this->_ci->load->view("home/template/v_sidebar", $data, true);
        $data['bagian']['footer'] = $this->_ci->load->view("home/template/v_footer", $data, true);
        $data['bagian']['content']= $this->_ci->load->view($view, $data, true);
        
        $this->_ci->load->view("home/template/index", $data);
    }

    function admin($view, $data, $position = "", $TITLE = "", $DESKRIPSI = "")
    {
        if($this->_ci->session->userdata('logged_in'))
        {
            $data['TITLE'] = $TITLE;
            $data['bagian']['deskripsi'] = $DESKRIPSI;
            $data['bagian']['position'] = $position;
            $data['bagian']['head']   = $this->_ci->load->view("admin/template/v_head", $data, true);
            $data['bagian']['css']    = $this->_ci->load->view("admin/template/v_css", $data, true);
            $data['bagian']['js']     = $this->_ci->load->view("admin/template/v_script", $data, true);
            $data['bagian']['topbar'] = $this->_ci->load->view("admin/template/v_topbar", $data, true);
            $data['bagian']['sidebar']= $this->_ci->load->view("admin/template/v_sidebar", $data, true);
            $data['bagian']['footer'] = $this->_ci->load->view("admin/template/v_footer", $data, true);
            $data['bagian']['content']= $this->_ci->load->view($view, $data, true);

            $this->_ci->load->view("admin/template/index", $data);
        }
        else
        {
            redirect('admin');
        }
    }
}

/* End of file template.php */
/* Location: ./application/libraries/template.php */